package com.oa.common.vo;

import com.oa.entities.User;

import java.io.Serializable;
import java.util.Objects;

/**
 * 用户登录存储信息类
 *
 */
public class Propal implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1644042308572664777L;

    /** 用户名 **/
    private String username;

   /** 存储的ip **/
   private String ip;

   /** 用户的id **/
   private Long id;

   /** 用户的密码 **/
   private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Propal propal = (Propal) o;
        return Objects.equals(username, propal.username) &&
                Objects.equals(ip, propal.ip) &&
                Objects.equals(id, propal.id);
    }

    @Override
    public int hashCode() {

        return Objects.hash(username, ip, id);
    }

    @Override
    public String toString() {
        return "Propal{" +
                "username='" + username + '\'' +
                ", ip='" + ip + '\'' +
                ", id=" + id +
                '}';
    }

    /**
     * 用户的信息
     *
     * @param user
     * 用户类
     *
     * @param ip
     * ip的名称
     *
     * @param password
     * 用户的密码
     *
     */
    public Propal(User user,String ip,String password){
        this.id= user.getId();
        this.username= user.getUsername();
        this.ip= ip;
        this.password= password;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
